
import 'package:currency_balance/pages/assets_detail_page.dart';
import 'package:currency_balance/pages/assets_history_page.dart';
import 'package:currency_balance/pages/home_page.dart';
import 'package:flutter/material.dart' hide Page;

import 'bean/balance_detail.dart';
import 'bean/invoice_info.dart';
import 'bean/transaction_history.dart';

Widget createApp() {

  return MaterialApp(
    title: 'Currency Balance Info',
    debugShowCheckedModeBanner: false,
    theme: ThemeData(
      primarySwatch: Colors.blue,
    ),
    routes: {
      'homePage':(context) => HomePage(),
      'assetsDetailPage':(context) {
        Map<String,dynamic> settings = ModalRoute.of(context)!.settings.arguments as Map<String, dynamic>;
        BalanceDetail balanceDetail = settings['assetDetail'];
        FlashBalance? flashBalanceDetail = settings['flashAssetDetail'];
        InvoiceInfo? invoiceInfo = settings['invoiceInfo'];
        return AssetsDetailPage(balanceDetail: balanceDetail,flashBalanceDetail: flashBalanceDetail,invoiceInfo: invoiceInfo,);
      },
      'assetsHistoryPage':(context) {
        Map<String,dynamic> settings = ModalRoute.of(context)!.settings.arguments as Map<String, dynamic>;
        List<TransactionHistory> historyList = settings['historyList'];
        return AssetsHistoryPage(historyList: historyList,);
      }
    },
    home: HomePage(),
  );
}
